<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>双色球</title>
  </head>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .box {
      width: 100%;
      height: 100vh;
      display: flex;
      align-items: center;
      flex-direction: column;
      justify-content: center;
    }
    #result {
      width: 100%;
      height: 20vh;
      display: flex;
      justify-content: space-around;
      align-items: center;

      span {
        display: inline-flex;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        border-radius: 100%;
        color: azure;
        background-image: linear-gradient(180deg, #fe8a5c 0%, #ff4d4d 100%);

        &:last-child {
          background-image: linear-gradient(180deg, #31caf5 0%, #198cff 100%);
        }
      }
    }
    .make-btn {
      margin-top: 50px;
      border: none;
      outline: none;
      width: 40%;
      height: 40px;
      line-height: 40px;
      border-radius: 5px;
    }
  </style>
  <body>
    <div class="box">
      <div id="result"></div>
      <button class="make-btn" onclick="make()">重新生成</button>
    </div>
  </body>

  <script>
    function make() {
      const res = [];

      while (res.length < 6) {
        const rand = (Math.random() * 31).toFixed(0);
        if (rand != 0 && !res.includes(rand)) res.push(rand);
      }

      while (res.length < 7) {
        const rand = (Math.random() * 16).toFixed(0);
        if (rand != 0 && !res.includes(rand)) res.push(rand);
      }

      console.log(res);

      str = "";
      res.forEach((v) => {
        str += `<span>${v}</span>`;
      });

      document.querySelector("#result").innerHTML = str;
    }

    make();
  </script>
</html>
